﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;

namespace Proggy.Web.Cms.PropertyTypes
{
    /// <summary>
    /// The property type base class
    /// </summary>
    public abstract class PropertyTypeBase
    {
        /// <summary>
        /// The name start for the property for forms
        /// </summary>
        [JsonIgnore]
        public string PropertyNameStart { get; set; }

        /// <summary>
        /// Returns a unique string for an element id
        /// </summary>
        /// <param name="prefix"></param>
        /// <param name="suffix"></param>
        /// <returns></returns>
        public string GetUniqueElementId(string prefix, string suffix)
        {
            Guid g = Guid.NewGuid();
            string guidString = Convert.ToBase64String(g.ToByteArray());
            guidString = guidString.Replace("=", "");
            guidString = guidString.Replace("+", "");
            guidString = guidString.Replace("/", "");

            return prefix + guidString + suffix;
        }        
    }
}
